<?php

namespace app\modules\cruise\models;

use Yii;

/**
 * This is the model class for table "room_code_use".
 *
 * @property int $id
 * @property int $cruise_id 邮轮ID
 * @property int $room_code_id room Code ID
 * @property string $code 房间号
 * @property int $is_use 是否使用 1 未使用 2使用
 * @property int $user_id 管理员编号
 * @property string $created_at
 * @property string $updated_at
 */
class RoomCodeUse extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'room_code_use';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['cruise_id', 'room_code_id', 'is_use', 'user_id'], 'integer'],
            [['created_at', 'updated_at'], 'safe'],
            [['code'], 'string', 'max' => 20],
            [['cruise_id', 'room_code_id'], 'unique', 'targetAttribute' => ['cruise_id', 'room_code_id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'cruise_id' => 'Cruise ID',
            'room_code_id' => 'Room Code ID',
            'code' => 'Code',
            'is_use' => 'Is Use',
            'user_id' => 'User ID',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }
}
